home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Mania 4
/
MacMania 4.toast
/
/
Demo's
/
Igor Demo Pro
/
1 PutContentsIn Igor Pro Folder
/
More Extensions
/
File Loaders
/
TDLoadWave Documentation
< prev
Wrap
Text File
|
1994-03-24
|
10KB
|
232 lines
*** TDLoadWave XOP, Version 1.20, 3/24/94 ***
TDLoadWave adds a 'Load Tab-delimited File' item to the 'Load Waves'
submenu of Igor's 'File' menu. It also adds the TDLoadWave and TDSaveWave
operations to Igor.
Igor Pro users should use the delimited-text file loading and saving
capability that is built-in to Igor Pro. Use TDLoadWave only if you
want to run under Igor 1.2.
TDLoadWave behaves much like the built-in LoadWave operation
in Igor 1.2 except for the following:
it loads tab-delimited files with missing values
it will look for column names in the file it is loading
the number of rows and columns that it can load is unlimited
it can be made to skip columns under macro control
The TDLoadWave XOP also adds an TDSaveWave operation which you can
access through the command line but has no menu item.
To use this or any other XOP you must put the XOP file in the folder
containing the Igor 1.2 application and then launch Igor 1.2.
There are some release notes about this version of TDLoadWave at the
end of this file.
TDLoadWave is designed to load data from "tab-delimited files".
This means that the text in the file is of the form:
number tab number tab number carriage-return
This is a very common Macintosh file format. If your file does not
have this format, TDLoadWave will not be able to load it.
TDLoadWave starts out by trying to determine the number of columns
in the file. It does this by counting tabs in the first row of text.
TDLoadWave then looks at the first row in the file and determines if
the file contains column names. It does this by looking at the first
non-white-space character. If this is an alpha character,
TDLoadWave assumes that the row contains column names. If it is a
numeric character TDLoadWave decides that the file does not contain
column names.
If your file contains column names but they are not in the first row,
or contains other garbage at the beginning that you want to skip,
you can force TDLoadWave to skip some rows by using the /S option,
described below.
TDLoadWave creates and sets the file-loader output variables
V_flag, S_fileName and S_waveNames. It sets V_flag to the
number of waves loaded. It sets S_fileName to the name of the
file loaded for use in annotating a graph. It sets S_waveNames
to a semicolon-separated list of the names of the waves that were
loaded.
You can access TDLoadWave through its menu item or by invoking the
TDLoadWave operation from the command line or from a macro.
*** TDLoadWave Operation ***
The TDLoadWave operation has the following syntax:
TDLoadWave [[/P=path]/O/D/I/T/Q/A[=basename]] "filename"
/P=path specifies a path where file can be found.
/O causes new waves to overwrite existing waves of the same name.
/D causes the new waves to be double precision.
/I causes TDLoadWave to put up the standard open dialog.
/Q suppresses normal diagnostic messages during load.
/N like /A but reuses existing names.
/N=basename like /A but reuses existing names.
/T inhibits trimming of missing data points from the end of waves
/S={skipBefore, skipAfter, maxRows, startCol, endCol, colControlString}
If neither /A nor /N is used then wave names are generated from
the column names in the file. If there are no column names in the file, the
default "Column" is used as a base name.
"filename" is a full file name for the file to load
or a partial file name if /P is used.
If "filename" is omitted TDLoadWave puts up the standard open dialog.
The /S={...} option allows you to force TDLoadWave to skip some of the
rows and/or columns in the file:
skipBefore is the number of lines of text to skip before attempting to
determine the number of columns in the file or to read column names
from the file.
skipAfter is the number of lines of text to skip after reading column
names from the file. If TDLoadWave finds no column names then it
ignores this parameter.
maxRows is the maximum number of rows of numeric data that
TDLoadWave will load. This parameter lets you read a subset of the rows
in the file. If it is zero then this means "load all the rows in the file".
startCol, endCol and colControlString work together to allow you to
load a subset of the columns in the file.
If colControlString is "" then startCol and endCol set the first and last
column to load. 0 is the first column in the file. If endCol is 0 then
endCol is taken to be the last column in the file.
If colControlString is something other than "" then it controls what
columns are loaded. In this case TDLoadWave ignores startCol and endCol.
Each character in colControlString controls the loading of one column.
If the character is '0' (the digit zero), then the column is NOT loaded.
If the character is anything other than '0', the column IS loaded.
If there are more columns in the file than characters in colControlString,
then TDLoadWave fills colControlString out with '0' characters.
colControlString can not exceed 256 characters.
Here are some examples using /S={...}. These examples assume that you
have created a symbolic path with the name thePath and that the folder
identified by thePath contains a tab-delimited file with the name "Data".
| Load all rows and columns (same as if /S={...} were omitted
TDLoadWave/P=thePath/S={0, 0, 0, 0, 0, ""} "Data"
| Skip 5 lines, look for name row, then load up to 100 rows
TDLoadWave/P=thePath/S={5, 0, 100, 0, 0, ""} "Data"
| Look for name row, skip 100 rows, then load till end of file
TDLoadWave/P=thePath/S={0, 100, 0, 0, 0, ""} "Data"
| Load columns 1 through 3 (1 is the second column in the file)
TDLoadWave/P=thePath/S={0, 0, 0, 1, 3, ""} "Data"
| Load columns 0, 3, 4 and 6
TDLoadWave/P=thePath/S={0, 0, 0, 0, 0, "1001101"} "Data"
| Load up to 75 rows starting from row 50 but only in columns 27-35
TDLoadWave/P=thePath/S={50, 0, 75, 27, 35, ""} "Data"
*** TDSaveWave Operation ***
You can access the TDSaveWave operation from the command line or from a
macro. It has the following syntax:
TDSaveWave [[/P=path]/O/I/Q] wavelist [as "filename"]
/P=path specifies a path in which to save file.
/O causes an existing file of the same name to be overwritten
/I causes TDSaveWave to put up the standard save dialog.
/Q suppresses normal diagnostic messages during save.
wavelist is a list of wave names to save.
There are two ways to specify the wave list.
Normally you would use a comma-separated list of wave names:
TDSaveWave/P=path wave0, wave1, wave2 as "fileName"
This technique is limited by the fact that the Igor command line can hold no
more than 200 characters.
The second way uses an Igor string variable to contain a comma or
semicolon-separated list of wave names:
String waves
waves = "wave0, wave1, wave2"
waves += ", wave3, wave4, wave5"
TDSaveWave/P=path $waves as "fileName"
Using this technique the number of waves that you can write to a file is
limited only by available memory.
"filename" is a full file name for the file to save
or a partial file name if /P is used.
If as "filename" is omitted TDSaveWave puts up the standard save dialog.
Double precision waves are saved with up to 15 digits of precision. Complex
waves are saved as two columns. The column names have .real and .imag suffexes.
***** RELEASE NOTES **********
*** Release 1/17/92 ***
This version of TDLoadWave is much faster than the original. On a MacIIfx
the new version is more than 6 times faster than the original version when
loading local large files and is more than 20 times faster when loading files
from a file server.
Note: with heroic effort TDLoadWave could be made even faster - perhaps
more than twice as fast. If this would be important to you please let us
know.
TDLoadWave can take a new flag, /T, that inhibits the automatic trimming
of missing data points from the end of waves.
Columns containing only a single data point after trimming are no longer
discarded.
TDLoadWave attempts to be less easily confused by files that don't
have a consistent number of tabs in each row. The number of columns in
the file is taken from the number of tabs in the first row. If later rows
have too many columns then the excess data is discarded. If later rows have
too few columns then missing data values (NaNs) are used for the remaining
columns.
The new TDSaveWave allows up to 50 waves to be saved where the old
only allowed 8. (Actually we don't think TDSaveWave ever worked) In order
to save 40 waves the names had better be very short since the list has to
fit on one line.
*** Release 5/5/92 ***
In this version we added the /S={...} option. This allows you to make
TDLoadWave skip various rows and/or columns so that you can load
a subset of a file.
Changed things so that if TDLoadWave finds a column name that conflicts
with an Igor function or operation (e.g. "Time"), it will change the name
by prepending "X_" (e.g. "X_Time"). Previously, it would have just given
an error message and quit.
*** Release 8/3/92 ***
In this release we added the $<string variable> syntax to TDSaveWave.
This allows you to save any number of waves.
*** Release 3/24/94, version 1.20 ***
This version adds support for the file-loader output variable
S_waveNames which TDLoadWave sets to a semicolon-separated
list of the names of the waves that were loaded.
Previous versions set the file-loader output variable S_fileName
only if it existed. This version will create it if it does not exist.